package com.yzf.demo.demo.array.FailFast;

import java.util.Iterator;
import java.util.List;

/**
 * Created by 于占峰 on 2020/3/26/026.
 */
public class ThreadIterate extends Thread {
    private List list;

    public ThreadIterate(List list) {
        this.list = list;
    }

    @Override
    public void run() {
        while (true) {
            for (Iterator iterratorTmp = list.iterator(); iterratorTmp.hasNext(); ) {
                iterratorTmp.next();
                try {
                    Thread.sleep(5);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
